<template>
 <div>
  
    <li v-for="(item,index) in number" :key="index">{{item}}
      <button @click="del(index)">删除</button>
    </li>
    <button @click="fn">生成</button>
 </div>
</template>

<script>
 export default {

   data () {
     return {
      number:[1,2,3],
      a:''
     }
   },
   methods: {
    fn(){
      this.a=Math.floor(Math.random()*21)
      this.number.push(this.a)
    },
    del(index){
      this.number.splice(index,1)
     

    }


   },
 
 }
</script>

<style>

</style>